/**
 * @Title: NavPoiSearchListAdapter.java
 * @author zengshuai shi
 * @date 2015年8月5日 下午3:43:18
 */
package com.shanghaionstar.nav.adapter;

import android.content.Context;
import android.widget.TextView;

import com.onstar.cn.framework.annotation.FindViewById;
import com.onstar.cn.framework.base.CommonAdapter;
import com.onstar.cn.framework.base.CommonViewHolder;
import com.onstar.cn.map.common.PoiItemInfo;
import com.shanghaionstar.R;

import java.util.List;

/**
 * @author jun chen
 * @ClassName: NavPoiSearchListAdapter
 * @date 2016年4月15日 下午1:45:20
 * @Description: 搜索列表適配器
 */
public class NavPoiSearchListAdapter extends CommonAdapter<PoiItemInfo> {
    private Context mContext;
    private List<PoiItemInfo> mItemList;
    private boolean isHistroy = false;
    private int poiLength;

    public NavPoiSearchListAdapter(List<PoiItemInfo> datas, Context context, boolean isHistroy, int poiLength) {
        super(datas, context);
        mContext = context;
        mItemList = datas;
        this.isHistroy = isHistroy;
        this.poiLength = poiLength;
    }

    public void setmItemList(List<PoiItemInfo> mItemList) {
        this.mItemList = mItemList;
    }

    @Override
    public void getView(int position, CommonViewHolder viewHolder) {
        ViewHolder holder = (ViewHolder) viewHolder;

        String title = mItemList.get(position).getTitle();
        holder.poi_title_text_id.setText(title);

        String address = mItemList.get(position).getAddress();
        holder.poi_address_text_id.setText(address);

    }

    @Override
    public int layoutId() {
        return R.layout.nav_search_result_item;
    }

    @Override
    public CommonViewHolder getViewHolder() {
        return new ViewHolder();
    }

    private class ViewHolder extends CommonViewHolder {
        @FindViewById(R.id.poi_title_text_id)
        TextView poi_title_text_id;
        @FindViewById(R.id.poi_address_text_id)
        TextView poi_address_text_id;

    }
}
